package com.kailing.bootBatch.A.longest;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * <h3>partitionjob</h3>
 * <p>最长不重复子字符串</p>
 *
 * @author : hduong
 * @version : 1.0
 * @date : 2019-12-19 15:12
 **/
public class LongestStringNoRepeat {

    /**
     * 获取一个字符串 所有子串
     */
    public static List<String> getAllChildString(String s) {
        int lent = s.length();
        Set<String> set = new HashSet<>();
        for (int i = 0; i < lent; i ++) {
            for (int j = i; j <= lent; j ++) {
                set.add(s.substring(i, j));
            }
        }
        return new ArrayList<>(set);
    }

    /**
     * 滑动窗口
     * @param args
     */

    public static void main(String[] args) {
        List<String> list = getAllChildString("abc");
        for (String s : list) {
            System.out.println(s);
        }
    }


}
